package com.example.work.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.work.entity.TbHospCheckCategory;
import com.example.work.mapper.TbHospCheckCategoryMapper;
import com.example.work.service.ITbHospCheckCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ITbHospCheckCategoryServiceImpl extends ServiceImpl<TbHospCheckCategoryMapper, TbHospCheckCategory> implements ITbHospCheckCategoryService {

    @Autowired
    private TbHospCheckCategoryMapper tbHospCheckCategoryMapper;



    /**
     * 查看该批次下所有的项目是否都完成
     * **/
    @Override
    public Boolean isBatchCategoryCompleted(String batchId) {
        List<TbHospCheckCategory> categories = lambdaQuery().eq(TbHospCheckCategory::getBatchId, batchId).list();
        for(TbHospCheckCategory category : categories){
            if(!category.getDeleteFlag())
                return false;
        }
        return true;
    }
}
